﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint;
using System.Web.UI;

namespace Havivi.PropertyBagSettings
{
    public class PBSPageBase : LayoutsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SPUtility.EnsureSessionCredentials(SPSessionCredentialsFlags.RequireAuthentication);

            if (!SPContext.Current.Web.DoesUserHavePermissions(Microsoft.SharePoint.SPBasePermissions.ManageWeb))
            {
                SPUtility.Redirect(SPUtility.AccessDeniedPage + "?Source=" + SPHttpUtility.UrlKeyValueEncode(SPContext.Current.Web.Site.MakeFullUrl(Request.RawUrl)), SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);
            }
        }
    }
}